<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			#demo {
				width: 500px;
				height: 300px;
				border: 1px solid black;
			}
		</style>
		<script src="https://cdn.bootcss.com/jquery/1.8.1/jquery.min.js"></script>
		<script type="text/javascript">
			function test() {
				
				jQuery.ajax({
					url:"data.html",
					async:true,
					data:{
						username:"zhangsan",
						password:"123"
					},
					type:"get",// post
					//dataType:"text",// json jsonp xml text script 
					beforeSend:function(){
						//alert("beforeSend")
					},
					success:function  (text) {
						//alert(text)
						
						
						eval(text)
						
						$("#demo").html(text)
					},
					error:function (xhr,textStatus){
						alert(xhr.status)
					},
					complete:function  () {
						alert("结束2")
					}
				})
				
				alert("结束1")
				
				
				
				
			}
			
			
			
			
			// txt = 1+2 
			function cal (txt){
				alert(eval(txt))
			}
			
			cal(" 4 + 5 / 3")
			
			
			
		</script>
	</head>

	<body>

		<h1>demo</h1>
		<button onclick="test()">TEST</button>
		<div id="demo">

		</div>

	</body>

</html>